<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-item label="创建人">
              <a-input placeholder="请输入创建人" v-model="queryParam.createBy"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="12" :sm="16">
            <a-form-item label="创建日期">
              <j-date
                placeholder="请选择开始日期"
                class="query-group-cust"
                v-model="queryParam.createTime_begin"
              ></j-date>
              <span class="query-group-split-cust"></span>
              <j-date
                placeholder="请选择结束日期"
                class="query-group-cust"
                v-model="queryParam.createTime_end"
              ></j-date>
            </a-form-item>
          </a-col>
          <template v-if="toggleSearchStatus">
            <a-col :md="6" :sm="8">
              <a-form-item label="更新人">
                <a-input placeholder="请输入更新人" v-model="queryParam.updateBy"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="12" :sm="16">
              <a-form-item label="更新日期">
                <j-date
                  placeholder="请选择开始日期"
                  class="query-group-cust"
                  v-model="queryParam.updateTime_begin"
                ></j-date>
                <span class="query-group-split-cust"></span>
                <j-date
                  placeholder="请选择结束日期"
                  class="query-group-cust"
                  v-model="queryParam.updateTime_end"
                ></j-date>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <a-form-item label="订单编号">
                <a-input placeholder="请输入订单编号" v-model="queryParam.query07"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <a-form-item label="合同编号">
                <a-input placeholder="请输入合同编号" v-model="queryParam.query08"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <a-form-item label="合同名称">
                <a-input placeholder="请输入合同名称" v-model="queryParam.query09"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <a-form-item label="合同状态">
                <a-input placeholder="请输入合同状态" v-model="queryParam.query10"></a-input>
              </a-form-item>
            </a-col>
          </template>
          <a-col :md="6" :sm="8">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="getdataliuch" icon="search">根据流程号获取订单</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
              </a>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <a-button type="primary" icon="download" @click="handleExportXls('公证订单主表')">导出</a-button>
      <a-upload
        name="file"
        :showUploadList="false"
        :multiple="false"
        :headers="tokenHeader"
        :action="importExcelUrl"
        @change="handleImportExcel"
      >
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel"><a-icon type="delete" />删除</a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down"/></a-button>
      </a-dropdown>
    </div>

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择
        <a style="font-weight: 600">{{ selectedRowKeys.length }}</a
        >项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :scroll="{ x: 2450 }"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{ fixed: true, selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
        @change="handleTableChange"
      >
        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无此图片</span>
          <img
            v-else
            :src="getImgView(text)"
            height="25px"
            alt="图片不存在"
            style="max-width:80px;font-size: 12px;font-style: italic;"
          />
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无此文件</span>
          <a-button v-else :ghost="true" type="primary" icon="download" size="small" @click="uploadFile(text)">
            下载
          </a-button>
        </template>

        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>

          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>

    <fxyGzgl01-modal ref="modalForm" @ok="modalFormOk"></fxyGzgl01-modal>
  </a-card>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import FxyGzgl01Modal from './modules/FxyGzgl01Modal'
import JDate from '@/components/jeecg/JDate.vue'
import { getAction,postAction } from '@/api/manage'

export default {
  name: 'FxyGzgl01List',
  mixins: [JeecgListMixin],
  components: {
    JDate,
    FxyGzgl01Modal
  },
  data() {
    return {
      description: '公证订单主表管理页面',
      // 查询条件
      queryParam: {},
      // 表头
      columns: [
        {
          title: '#',
          width: 50,
          fixed: 'left',
          dataIndex: '',
          key: 'rowIndex',
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '操作',
          width: 150,
          fixed: 'left',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' }
        },
        {
          title: '创建人',
          width: 150,
          align: 'center',
          dataIndex: 'createBy'
        },
        {
          title: '创建日期',
          width: 150,
          align: 'center',
          dataIndex: 'createTime',
          customRender: function(text) {
            return !text ? '' : text.length > 10 ? text.substr(0, 10) : text
          }
        },
        {
          title: '更新人',
          width: 150,
          align: 'center',
          dataIndex: 'updateBy'
        },
        {
          title: '更新日期',
          width: 150,
          align: 'center',
          dataIndex: 'updateTime',
          customRender: function(text) {
            return !text ? '' : text.length > 10 ? text.substr(0, 10) : text
          }
        },
        {
          title: '所属部门',
          width: 150,
          align: 'center',
          dataIndex: 'sysOrgCode'
        },
        {
          title: '租户ID',
          width: 150,
          align: 'center',
          dataIndex: 'query01'
        },
        {
          title: '是否有效',
          width: 150,
          align: 'center',
          dataIndex: 'query02'
        },
        {
          title: '流程类型',
          width: 150,
          align: 'center',
          dataIndex: 'query03'
        },
        {
          title: '流程名称',
          width: 150,
          align: 'center',
          dataIndex: 'query04'
        },
        {
          title: '流程步骤',
          width: 150,
          align: 'center',
          dataIndex: 'query05'
        },
        {
          title: '流程备注',
          width: 150,
          align: 'center',
          dataIndex: 'query06'
        },
        {
          title: '订单编号',
          width: 150,
          align: 'center',
          dataIndex: 'query07'
        },
        {
          title: '合同编号',
          width: 150,
          align: 'center',
          dataIndex: 'query08'
        },
        {
          title: '合同名称',
          width: 150,
          align: 'center',
          dataIndex: 'query09'
        },
        {
          title: '合同状态',
          // width: 150,
          align: 'center',
          dataIndex: 'query10'
        }
        // {
        //   title:'备用2',
        //   align:"center",
        //   dataIndex: 'query11'
        // },
        // {
        //   title:'备用3',
        //   align:"center",
        //   dataIndex: 'query12'
        // },
        // {
        //   title:'备用4',
        //   align:"center",
        //   dataIndex: 'query13'
        // },
        // {
        //   title:'备用5',
        //   align:"center",
        //   dataIndex: 'query14'
        // },
        // {
        //   title:'备用6',
        //   align:"center",
        //   dataIndex: 'query15'
        // },
        // {
        //   title:'备用7',
        //   align:"center",
        //   dataIndex: 'query16'
        // },
        // {
        //   title:'备用8',
        //   align:"center",
        //   dataIndex: 'query17'
        // },
        // {
        //   title:'备用9',
        //   align:"center",
        //   dataIndex: 'query18'
        // },
        // {
        //   title:'备用10',
        //   align:"center",
        //   dataIndex: 'query19'
        // },
        // {
        //   title:'备用11',
        //   align:"center",
        //   dataIndex: 'query20'
        // },
        // {
        //   title:'备用12',
        //   align:"center",
        //   dataIndex: 'query21'
        // },
        // {
        //   title:'备用13',
        //   align:"center",
        //   dataIndex: 'query22'
        // },
        // {
        //   title:'备用14',
        //   align:"center",
        //   dataIndex: 'query23'
        // },
        // {
        //   title:'备用15',
        //   align:"center",
        //   dataIndex: 'query24'
        // },
        // {
        //   title:'备用16',
        //   align:"center",
        //   dataIndex: 'query25'
        // },
        // {
        //   title:'备用17',
        //   align:"center",
        //   dataIndex: 'query26'
        // },
        // {
        //   title:'备用18',
        //   align:"center",
        //   dataIndex: 'query27'
        // },
        // {
        //   title:'备用19',
        //   align:"center",
        //   dataIndex: 'query28'
        // },
        // {
        //   title:'备用20',
        //   align:"center",
        //   dataIndex: 'query29'
        // },
        // {
        //   title:'备用21',
        //   align:"center",
        //   dataIndex: 'query30'
        // },
        // {
        //   title:'备用22',
        //   align:"center",
        //   dataIndex: 'query31'
        // },
        // {
        //   title:'备用23',
        //   align:"center",
        //   dataIndex: 'query32'
        // },
        // {
        //   title:'备用24',
        //   align:"center",
        //   dataIndex: 'query33'
        // },
        // {
        //   title:'备用25',
        //   align:"center",
        //   dataIndex: 'query34'
        // },
        // {
        //   title:'备用26',
        //   align:"center",
        //   dataIndex: 'query35'
        // },
        // {
        //   title:'备用27',
        //   align:"center",
        //   dataIndex: 'query36'
        // },
        // {
        //   title:'备用28',
        //   align:"center",
        //   dataIndex: 'query37'
        // },
        // {
        //   title:'备用29',
        //   align:"center",
        //   dataIndex: 'query38'
        // },
        // {
        //   title:'备用30',
        //   align:"center",
        //   dataIndex: 'query39'
        // },
      ],
      url: {
        list: '/gzgl/fxyGzgl01/list',
        delete: '/gzgl/fxyGzgl01/delete',
        deleteBatch: '/gzgl/fxyGzgl01/deleteBatch',
        exportXlsUrl: '/gzgl/fxyGzgl01/exportXls',
        importExcelUrl: 'gzgl/fxyGzgl01/importExcel',
        getdata: '/gzgl/fxyGzgl01/getdata'
      },
      dictOptions: {}
    }
  },
  created() {
    
  },
  computed: {
    importExcelUrl: function() {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    }
  },
  methods: {
    initDictConfig() {},
    getdataliucah() {
      console.log(window._CONFIG['domianURL'])
      // let url = window._CONFIG['domianURL']+'/'+this.url.getdata;
      let url = 'http://localhost:3000/jeecg-boot/'+this.url.getdata;
      // let url = 'http://localhost:3000/jeecg-boot/'+this.url.list;
      console.log('a');
      console.log(url);
      console.log(this.queryParam);
      let param = this.queryParam.query07;
      getAction(url,this.queryParam,'get').then((res) => {
        console.log(res);
        console.log('c');
      })
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
